package com.blb.test.test3;

import com.blb.demo2.Baozi;

import java.util.ArrayList;
import java.util.List;

/**
 * 售票处
 */
public class TicketOffice {
    public static final int MAX_COUNT=50;
    private List<Ticket> ticketList1=new ArrayList<>();
   private List<List<Ticket>> ticketOffice=new ArrayList<>();

    public synchronized void makeTicket(){
        for (int i = 0; i < 4; i++) {
            ArrayList<Ticket> ticketList = new ArrayList<>();
            for (int j = 0; j < 50; j++) {
                ticketList.add(new Ticket("第"+i+"号售票处，第"+j+"张票"));
            }
            ticketOffice.add(ticketList);
        }
        this.notify();
    }


    public synchronized void sellTicket(){
        if (this.isTicketHave()){

        }



    }

    public boolean isTicketHave(){
        for (List<Ticket> tickets : this.ticketOffice) {
            if (!tickets.isEmpty()){
                return true;
            }
        }
        return false;
    }




}
